import mmdiy

min_length = 8
max_length = 18

concator_mid = [
    '.',
    ',',
    '@',
    '!',
    '~',
]

concator_end = [
    '.',
    ',',
    '!',
    '(',
    '..',
    '**',
]

suffixes = [
    '666',
    '520',
    '5201314',
]

def get_name_birth(name, birth) :

    pwds = mmdiy.Password()

    pwds.add_component(
        mmdiy.get_xing(name) 
        + mmdiy.get_Xing(name)
        + mmdiy.get_ming(name)
        + mmdiy.get_Ming(name)
        + mmdiy.get_name(name)
        + mmdiy.get_Name(name)
    )

    pwds.add_component(
        mmdiy.get_birh_yyyymmdd(birth)
        + mmdiy.get_birh_yymmdd(birth)
        + mmdiy.get_birh_mmdd(birth)
    )

    return pwds.get_pwds()

def get_name_symbol_birth(name, birth) :

    pwds = mmdiy.Password()

    pwds.add_component(
        mmdiy.get_xing(name) 
        + mmdiy.get_Xing(name)
        + mmdiy.get_ming(name)
        + mmdiy.get_Ming(name)
        + mmdiy.get_name(name)
        + mmdiy.get_Name(name)
    )

    pwds.add_component(concator_mid)

    pwds.add_component(
        mmdiy.get_birh_yyyymmdd(birth)
        + mmdiy.get_birh_yymmdd(birth)
        + mmdiy.get_birh_mmdd(birth)
    )

    return pwds.get_pwds()

def get_name_birth_symbol(name, birth) :

    pwds = mmdiy.Password()

    pwds.add_component(
        mmdiy.get_xing(name) 
        + mmdiy.get_Xing(name)
        + mmdiy.get_ming(name)
        + mmdiy.get_Ming(name)
        + mmdiy.get_name(name)
        + mmdiy.get_Name(name)
    )

    pwds.add_component(
        mmdiy.get_birh_yyyymmdd(birth)
        + mmdiy.get_birh_yymmdd(birth)
        + mmdiy.get_birh_mmdd(birth)
    )

    pwds.add_component(concator_end)

    return pwds.get_pwds()

def get_name_suffix(name) :

    pwds = mmdiy.Password()

    pwds.add_component(mmdiy.get_xing(name) 
        + mmdiy.get_Xing(name)
        + mmdiy.get_ming(name)
        + mmdiy.get_Ming(name)
        + mmdiy.get_name(name)
        + mmdiy.get_Name(name)
    )

    pwds.add_component(suffixes)

    return pwds.get_pwds()

def get_name_card(name, card) :

    pwds = mmdiy.Password()

    pwds.add_component(
        mmdiy.get_xing(name) 
        + mmdiy.get_Xing(name)
        + mmdiy.get_ming(name)
        + mmdiy.get_Ming(name)
        + mmdiy.get_name(name)
        + mmdiy.get_Name(name)
    )

    pwds.add_component(
        mmdiy.get_card(card)
    )

    return pwds.get_pwds()

def get_name_phone(name, phone) :

    pwds = mmdiy.Password()

    pwds.add_component(
        mmdiy.get_xing(name) 
        + mmdiy.get_Xing(name)
        + mmdiy.get_ming(name)
        + mmdiy.get_Ming(name)
        + mmdiy.get_name(name)
        + mmdiy.get_Name(name)
    )

    pwds.add_component(
        mmdiy.get_phone(phone)
    )

    return pwds.get_pwds()

def get_pwds(name, birth, card, phone) :
    
    pwd_list = get_name_birth(name, birth) \
    + get_name_symbol_birth(name, birth) \
    + get_name_birth_symbol(name, birth) \
    + get_name_suffix(name) \
    + get_name_card(name, card) \
    + get_name_phone(name, phone)

    pwds = mmdiy.Password()
    pwds.set_pwds(pwd_list)
    pwds.filter_min_len(min_length)
    pwds.filter_max_len(max_length)

    return pwds.get_pwds()

if __name__ == "__main__" :

    name = "张三丰"
    card = "301274199702063719"
    birth = "19970207"
    phone = "13790102265"

    # pwd1 = get_name_birth(name, birth)
    # print(len(pwd1), pwd1)

    # pwd2 = get_name_symbol_birth(name, birth)
    # print(len(pwd2), pwd2)

    # pwd3 = get_name_birth_symbol(name, birth)
    # print(len(pwd3), pwd3)

    # pwd4 = get_name_suffix(name)
    # print(len(pwd4), pwd4)

    # pwd5 = get_name_card(name, card)
    # print(len(pwd5), pwd5)

    # pwd6 = get_name_phone(name, phone)
    # print(len(pwd6), pwd6)

    pwds = get_pwds(name, birth, card, phone)
    print(len(pwds), pwds)